home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
CENVIW1.ZIP
/
WINLIST.CMM
< prev
next >
Wrap
Text File
|
1993-06-26
|
1KB
|
38 lines
// WinList.cmm Display a list of all windows and all their child windows
DisplayWindowChildren(0,NULL);
DisplayWindowChildren(ChildDepth,ParentHandle)
{
WList = WindowList(ParentHandle);
if ( NULL == WList ) return; // if no windows in this list, then nothing to display
count = 1 + GetArraySpan(WList);
for ( i = 0; i < count; i++ ) {
hwnd = WList[i];
// to avoid printing all windows more than once, only print if the direct
// parent is the ParentHandle of this depth
if ( ParentHandle == GetParentHandle(hwnd) ) {
printf("\n%*d",7 * ChildDepth,hwnd);
PrintWindowTextIfAny(hwnd)
DisplayWindowChildren(ChildDepth+1,hwnd);
}
}
}
PrintWindowTextIfAny(handle) // print name of window if it has one
{
#define MAX_TEXT_LEN 50
BLObSize(buf,MAX_TEXT_LEN+1);
if ( 0 != DynamicLink("USER","GETWINDOWTEXT",SWORD16,PASCAL,
handle,buf,MAX_TEXT_LEN) )
printf(" %s",buf);
}
GetParentHandle(WindowHandle)
{
return( DynamicLink("USER","GETPARENT",SWORD16,PASCAL,WindowHandle) );
}
getch();